﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
	CodeBehind="UpdataSn.aspx.cs" Inherits="SBACN.WebSite.UpdataSn" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
	<script type="text/javascript" src="js/md5.js"></script>
	<script type="text/javascript">
//		$jqy(function () {
//			window.event.keyCode = 1;
//			if (window.event.keyCode == 13) {
//				document.getElementById("<%= btn_Save.ClientID%>").click();
//			}
//		})
		function getimgcode() {
			var randomnum = Math.random();
			var getimagecode = document.getElementById("getcode");
			getimagecode.src = "ValidationImage.aspx?sn=Complain&" + randomnum;
		}
		function Check() {
			var userName = $jqy.trim(document.getElementById("<%= Username.ClientID%>").value);
			var Opassword = $jqy.trim(document.getElementById("<%= Osn.ClientID%>").value);
			var Npassword = $jqy.trim(document.getElementById("<%= Nsn.ClientID%>").value);
			var Rpassword = $jqy.trim(document.getElementById("<%= N2sn.ClientID%>").value);
			var Valid = $jqy.trim(document.getElementById("<%= txt_valid.ClientID%>").value);

			document.getElementById("<%= UMsg.ClientID%>").innerHTML = "";
			document.getElementById("<%= OMsg.ClientID%>").innerHTML = "";
			document.getElementById("<%= NMsg.ClientID%>").innerHTML = "";
			document.getElementById("<%= RMsg.ClientID%>").innerHTML = "";
			document.getElementById("<%= lblValid.ClientID%>").innerHTML = "";

			if (Valid.length < 4) {
				document.getElementById("<%= lblValid.ClientID%>").innerHTML = "请输入正确的验证码!";
				return false;
			}
			if (userName.length == 0) {
				document.getElementById("<%= UMsg.ClientID%>").innerHTML = "请输入用户名!";
				return false;
			}
			if (Opassword.length == 0) {
				document.getElementById("<%= OMsg.ClientID%>").innerHTML = "请输入旧密码!";
				return false;
			}
			if (Npassword.length == 0) {
				document.getElementById("<%= NMsg.ClientID%>").innerHTML = "请输入新密码!";
				return false;
			}
			if (Rpassword.length == 0) {
				document.getElementById("<%= RMsg.ClientID%>").innerHTML = "请输入确认新密码!";
				return false;
			}
			if (Npassword != Rpassword) {
				document.getElementById("<%= RMsg.ClientID%>").innerHTML = "两次密码不匹配！";
				return false;
			}

			document.getElementById("<%= Hid_Osn.ClientID%>").value = hex_md5(Opassword);
			document.getElementById("<%= Hid_Nsn.ClientID%>").value = hex_md5(Npassword);
			document.getElementById("<%= Hid_RNsn.ClientID%>").value = hex_md5(Rpassword);
			$jqy("#<%= Osn.ClientID%>").attr("disabled", "true");
			$jqy("#<%= Nsn.ClientID%>").attr("disabled", "true");
			$jqy("#<%= N2sn.ClientID%>").attr("disabled", "true");
			return true;
		}
		function CloseThisWin() {
			if (window.opener) {
				window.opener = null;
			}
			window.close();
			return false;
		}

		function DoLogin(e) {
			e = window.event || e;
			var key = e.keyCode || e.which;
			if (key == 13) {
				document.getElementById("<%= btn_Save.ClientID%>").click();
			}
		}
	</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
	<!--主内容区-->
	<div id="wrapper">
		<div id="nav" runat="server" clientidmode="Static">
			当前位置：<a href="/Index.aspx">首页</a> > 修改密码
		</div>
		<div id="change_pw">
			<div id="mainlogin_title">
				<img alt="" src="images/change_pwtitle.png" width="242" height="89" />
			</div>
			<div id="mainzone">
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="10">
					<tr>
						<td width="28%" align="right" class="mainlogin_font">
							<font color="#FF0000">*</font>用户名：
						</td>
						<td width="72%">
							<asp:TextBox name="Username" ID="Username" runat="server" CssClass="input_main" MaxLength="50"
								Width="250px"></asp:TextBox>
							<asp:Label ID="UMsg" runat="server" ForeColor="Red" Text=""></asp:Label>
						</td>
					</tr>
					<tr>
						<td align="right" class="mainlogin_font">
							<font color="#FF0000">*</font>旧密码：
						</td>
						<td>
							<asp:TextBox ID="Osn" runat="server" CssClass="input_main" MaxLength="50" Width="250px"
								TextMode="Password"></asp:TextBox>
							<asp:Label runat="server" Text="" ID="OMsg" ForeColor="Red"></asp:Label>
							<asp:HiddenField ID="Hid_Osn" runat="server" />
						</td>
					</tr>
					<tr>
						<td align="right" class="mainlogin_font">
							<font color="#FF0000">*</font>新密码：
						</td>
						<td align="left">
							<asp:TextBox ID="Nsn" runat="server" CssClass="input_main" MaxLength="50" Width="250px"
								TextMode="Password"></asp:TextBox>
							<asp:Label runat="server" Text="" ID="NMsg" ForeColor="Red"></asp:Label>
							<asp:HiddenField ID="Hid_Nsn" runat="server" />
						</td>
					</tr>
					<tr>
						<td align="right" class="mainlogin_font">
							<font color="#FF0000">*</font>确认新密码：
						</td>
						<td align="left">
							<asp:TextBox ID="N2sn" runat="server" CssClass="input_main" MaxLength="50" Width="250px"
								TextMode="Password"></asp:TextBox>
							<asp:Label runat="server" Text="" ID="RMsg" ForeColor="Red"></asp:Label>
							<asp:HiddenField ID="Hid_RNsn" runat="server" />
						</td>
					</tr>
					<tr>
						<td align="right" class="mainlogin_font">
							<font color="#FF0000">*</font>验证码：
						</td>
						<td align="left">
							<asp:TextBox name="txt_valid" ID="txt_valid" runat="server" CssClass="input_main"
								MaxLength="4" Width="60"></asp:TextBox>
							<img id="getcode" alt="" src="ValidationImage.aspx?sn=Complain" style="vertical-align: middle">&nbsp;&nbsp;<a
								href="javascript:getimgcode()">刷新验证码</a>
							<asp:Label ID="lblValid" runat="server" ForeColor="Red"></asp:Label>
						</td>
					</tr>
					<tr>
						<td align="center">
							&nbsp;
						</td>
						<td align="left" style="padding-left: 20px">
							<table width="100%" border="0" cellspacing="2" cellpadding="0">
								<tr>
									<td>
										<asp:Button runat="server" Text="确定" ID="btn_Save" CssClass="btnmainlogin" OnClick="btn_Save_Click"
											OnClientClick="return Check();" />
										<input type="button" value="取消" class="btnmainlogin" onclick="return CloseThisWin();" />
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
	<div style="clear: both;">
	</div>
	<!--主内容区-->
</asp:Content>
